<template>
  <div class="view-box">
    <div id="iframeBox" style="width: 0; height: 0;">
    </div>
    <RPIframe :src='singleIframeUrl' v-if="initFinish" :showFullBtn="false"></RPIframe>
  </div>
</template>
<script>
import RPIframe from '@/components/common/RPIframe.vue'
import coverApi from '@/api/cover.js'
export default {
  name: 'formManage',
  components: {
    RPIframe
  },
  props: {
    codeMap: {
      type: Array,
      default: () => []
    },
    iframeReadyCode: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {
      initFinish: false,
      singleIframeUrl: '',
      urlCodeList: []
    }
  },
  created: function () {
    this.init()
  },
  methods: {
    init() {
      coverApi.getCodeList('IFRAME_OUT_URL').then((res) => {
        let rescords = res.data.records
        if (rescords.length > 0) {
          const list = []
          rescords.forEach(item => {
            if (this.codeMap.includes(item.vsiKey)) {
              list.push(item);
            }
          });
          this.urlCodeList = list
          this.singleIframeUrl = this.urlCodeList[0].vsiDescription
          this.initFinish = true
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.view-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  .tabs-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    /deep/.ivu-tabs-content  {
      flex: 1;
    }
  }
}

</style>

